package echo;

import java.lang.Integer;

/**
 * Write a description of class ParteReal here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class ParteRealLeaf implements INumeroComplexoComponent 
{
    Integer a;
    
    /**
     * Constructor for objects of class ParteReal
     */
    public ParteRealLeaf()
    {
        a = new Integer(0);
    }
    
    public void zerar()
    {   
        a = new Integer(0);
    }

    public void entrarParteReal(Integer base, Integer n) 
    {
        a = a * base + n;
    }
    
    public void somarParteReal(Integer base, INumeroComplexoComponent numComposite) 
    {
        a = a + numComposite.getParteReal();
    }
    
    public void entrarParteImaginaria(Integer base, Integer n){}
    public void somarParteImaginaria(Integer base, INumeroComplexoComponent numComposite){}

    public Integer getParteReal()
    {
        return new Integer(a.intValue());
    } //!!!como remover isso
    
    public Integer getParteImaginaria(){return new Integer(0);} //!!!como remover isso
    
    public String toString()
    {
        return a.toString();
    }
    
    public String toBinaryString()
    {
        return "0b" + Integer.toBinaryString(a);        
    }

    public String toHexString()
    {
        return "0x" + Integer.toHexString(a);
    }
}
